package com.zj.study.payment.controller;

import com.zj.study.payment.service.UnitePayment;
import com.zj.study.pojo.FinalResultVO;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 赵赳
 * @since 2022/7/21 11:39
 */
@RestController
public class TestPaymentController {

  private final UnitePayment unitePayment;


  public TestPaymentController(UnitePayment unitePayment) {
    this.unitePayment = unitePayment;
  }

  /**
   * 支付策略模式测试
   *
   * @param type 支付方式
   * @return 响应
   */
  @PostMapping("/payment/{type}")
  public FinalResultVO<Boolean> payment(@PathVariable Integer type) {
    return FinalResultVO.ok(unitePayment.pay(type));
  }


}
